<template>
  <div>
    login-page\
    <button @click="login">登录</button>
  </div>
</template>

<script>
// import { login } from '@/api/user'
export default {
  name: 'login-page',
  props: {},
  components: {},
  data () {
    return {
    }
  },
  computed: {},
  watch: {},
  created () {
    this.login()
  },
  mounted () {
  },
  methods: {
    async login () {
      try {
        // const res = await login({
        //   mobile: '13800000002',
        //   password: '123456'
        // })
        // 把token存到vuex中
        // this.$store.commit('user/SET_TOKEN', res.data)
        await this.$store.dispatch('user/login')
        this.$router.push('/layout')
      } catch (error) {

      }
    }
  }

}
</script>

<style lang="less" scoped>
</style>
